<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page language="java" import="java.util.*,com.vo.*" pageEncoding="utf-8"%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%ArrayList<StudentVo> list = (ArrayList<StudentVo>)request.getAttribute("list"); %>
<html>
<head>
    <base href="<%=basePath%>">
    <meta name="viewport" content="width=device-width" />

    <title>StudentList</title>

    <script src="../Scripts/jquery-1.10.2.js"></script>
    <link href="../Content/bootstrap/bootstrap.min.css" rel="stylesheet">
    <script src="../Content/bootstrap/bootstrap.min.js"></script>
    <script src="../Content/bootstrap/bootstrap.js"></script>
    <link href="../Content/bootstrap/bootstrap.css" rel="stylesheet" />
    <script src="../Content/bootstrap-table/bootstrap-table.js"></script>
    <link href="../Content/bootstrap-table/bootstrap-table.css" rel="stylesheet" />
    <link href="../Content/bootstrap3-editable/css/bootstrap-editable.css">
    <link href="../Content/bootstrap3-editable/img/clear.png">
    <link href="../Content/bootstrap3-editable/img/loading.gif">
    <script src="../Content/bootstrap3-editable/js/bootstrap-editable.js"></script>

    <script src="Layout.js"></script>
    <script type="text/javascript">
        function selecta()
        {
            document.myform.action="SelectStudentServlet"

            document.myform.method="post"
        }

    </script>

</head>
<body>


<div class="panel-body" style="padding-bottom:0px;">
    <div class="alert alert-success" id="eventsResult"></div>
    <div class="panel panel-default">
        <div class="panel-heading">查询条件</div>
        <div class="panel-body">
            <form name = "myform" id="myform" class="form-horizontal" method="post">
                <div class="form-group" style="margin-top:15px" >
                    <label class="control-label col-sm-1" for="txt_search_departmentname">学号</label>
                    <div class="col-sm-3">
                        <input name = "stuNo" type="text" class="form-control" id="txt_search_departmentname">
                    </div>
                    <label class="control-label col-sm-1" for="txt_search_statu">姓名</label>
                    <div class="col-sm-3">
                        <input name ="stuName" type="text" class="form-control" id="txt_search_statu">
                    </div>
                    <label class="control-label col-sm-1">班级</label>
                    <div class="col-sm-3">
                        <input name ="class" type="text" class="form-control">
                    </div>

                    <label class="control-label col-sm-1">密码</label>
                    <div class="col-sm-3">
                        <input name ="password" type="text" class="form-control" id="txt_search_password">
                    </div>
                    <label class="control-label col-sm-1">ID</label>
                    <div class="col-sm-3">
                        <input name ="idcard" type="text" class="form-control" id="txt_search_ID">
                    </div>

                    <div  class="col-sm-4" style="text-align:left;">
                        <button type="submit" style="margin-left:50px" id="btn_query" class="btn btn-primary" onclick="selecta()">
                            <span class="glyphicon glyphicon-search" aria-hidden="true"></span>查询
                        </button>
                    </div>

                </div>
            </form>
        </div>
    </div>

    <div id="toolbar" class="btn-group">
        <button id="btn_add" type="button" class="btn btn-default" onclick="window.location.href='index.jsp'">
            <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>新增
        </button>
        <button id="btn_edit" type="button" class="btn btn-default">
            <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>修改
        </button>
        <button id="btn_delete" type="button" class="btn btn-default">
            <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>删除
        </button>

        <button id="btn_proc" type="button" class="btn btn-default" onclick="window.location.href='../proc.jsp'">
            <span class="glyphicon glyphicon-search" aria-hidden="true"></span>存储过程
        </button>

    </div>
    <table id="tb_student">
        <%
            for (int i = 0; i < list.size(); i++)
            {
        %>
        <tr>
            <td></td>
            <td><%=list.get(i).getStudentNum() %></td>
            <td><%=list.get(i).getStudentName() %></td>
            <td><%=list.get(i).getSex() %></td>
            <td><%=list.get(i).getStudentClass() %></td>
            <td><%=list.get(i).getPassword() %></td>
            <td><%=list.get(i).getIdCard() %></td>

            <td><a href="UpdateStudentServlet?userId=<%=list.get(i).getStudentNum() %>">修改</a>
                <a href="DeleteStudentServlet?userId=<%=list.get(i).getStudentNum() %>">删除</a>
            </td>
        </tr>
        <%
            }
        %>
    </table>
</div>

<br>
<div align="center">
    <br> <br> <br>
    <%
        out.print("数据查询成功");
    %>
</div>

<br>
<div align="center">
    <input type="button" value="返回" onclick="javascript:window.location.href ='index.jsp';">
</div>

</body>
</html>